package org.example.campus_sys_backend.service;

import org.apache.ibatis.annotations.Param;
import org.example.campus_sys_backend.mapper.ActivityInfoMapper;
import org.example.campus_sys_backend.model.ActivityInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Date;
import java.util.List;

@Service
public class ActivityService {
    @Autowired
    private ActivityInfoMapper activityInfoMapper;


    public Integer insertActivity(ActivityInfo activityInfo){
        return activityInfoMapper.insertActivity(activityInfo);
    }
    public Integer updateActivity(Integer id, String name, String category, String title,
                                  String creator, String abs, String detailedDesc,
                                  String status, @DateTimeFormat(pattern = "yyyy-MM-dd")Date createdTime,
                                  @DateTimeFormat(pattern = "yyyy-MM-dd") Date archivedTime,
                                  String picUrls,  @DateTimeFormat(pattern = "yyyy-MM-dd")Date startTime,
                                  @DateTimeFormat(pattern = "yyyy-MM-dd")Date endTime){
        return activityInfoMapper.updateActivity(id,name,category,title,creator,abs,detailedDesc,status,createdTime,archivedTime,picUrls,startTime,endTime);

    }
    public ActivityInfo queryActivityById(Integer id){
        return  activityInfoMapper.queryActivityById(id);
    }
    public List<ActivityInfo> selectActivity(String status, String name){
        return  activityInfoMapper.selectActivity(status,name);
    }
    public Integer openActivity(Integer id, String status){
        return activityInfoMapper.openActivity(id,status);
    }

}
